<div id="galleries">

<?php if ($galleries): ?>

  <?php foreach ($galleries as $gallery): ?>
  <div class="gallery clearfix">
    <h3 class="gallery-title">
      <?php echo link_to($gallery->getTitle(), '#') ?>
    </h3>
    <?php $c = new Criteria(); $c->addAscendingOrderByColumn(PicturePeer::POSITION); ?>
    <?php if ($gallery->getPictures($c) and $gallery->countPictures() > 0): ?>
    <div class="pictures clearfix">
      <?php foreach ($gallery->getPictures($c) as $picture): ?>
      <div class="picture">
        <p>
          <a class="lightwindow" rel="Aller à [<?php echo $gallery->getTitle() ?>]" href="/admin/uploads/galleries/gallery_<?php echo $gallery->getId() ?>/<?php echo $picture->getPath() ?>">
            <?php echo image_tag('/admin/uploads/galleries/gallery_'.$gallery->getId().'/thumbnail/'.$picture->getPath()) ?>
          </a>     
        </p>
      </div>
      <?php endforeach; ?>
    </div>
    <?php endif; ?>
    
  </div>
  <?php endforeach; ?>

<?php endif; ?>

</div>

<script type="text/javascript">
// <![CDATA[
(function($) {
  /* $('.pictures:gt(0)').hide(); */
  $('.gallery-title').bind('click', function() {
    if ($(this).siblings('.pictures').css('display') == 'block')
    {
      $(this).siblings('.pictures').slideUp();
    }
    else
    {
      $(this).siblings('.pictures').slideDown();
    }
    return false;
  });
})(jQuery);
// ]]>
</script>